#ifndef FFVDP_RECVER_H
#define FFVDP_RECVER_H
#include <libavcodec/avcodec.h>
#include <libavutil/buffer.h>
#include <stddef.h>

typedef struct ffvdp_recver_st ffvdp_recver_t;

typedef ffvdp_recver_t *(*ffvdp_recver_create_func_t)(const char *url);
typedef int (*ffvdp_recver_recv_func_t)(ffvdp_recver_t *recver,
                                        AVBufferRef **buf);
typedef void (*ffvdp_recver_destroy_func_t)(ffvdp_recver_t *recver);

struct ffvdp_recver_st {
    void *priv;
    ffvdp_recver_recv_func_t recv;
    ffvdp_recver_destroy_func_t destroy;
};

typedef struct ffvdp_recver_info_st {
    const char *name;
    const char *desc;
    ffvdp_recver_create_func_t create;
} ffvdp_recver_info_t;

ffvdp_recver_t *ffvdp_recver_create(const char *url);
int ffvdp_recver_recv(ffvdp_recver_t *recver, AVBufferRef **buf);
void ffvdp_recver_destroy(ffvdp_recver_t *recver);

int ffvdp_packet_recver_recv(ffvdp_recver_t *recver, AVBufferRef **buf);
void ffvdp_packet_recver_destroy(ffvdp_recver_t *recver);
ffvdp_recver_t *ffvdp_packet_recver_create(const char *url);
int ffvdp_packet_recver_recv_frame(ffvdp_recver_t *recver, AVPacket *pkt);
#endif
